package com.hxz.lesson02;
import com.hxz.lesson02.utils.JdbcUtils;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;



public class TestInsert {
    public static void main(String[] args) {
        Connection conn = null;
        Statement st = null;
        ResultSet rs = null;

        try {
            conn = JdbcUtils.getConnection(); // 获取数据库连接
            st = conn.createStatement(); // 获取sql的执行对象
            String sql = "INSERT INTO `users`(id,NAME,PASSWORD,email,birthday) VALUES(5,'dadsa','aaa','dsa@sina.com','1870-01-14')";

            int num = st.executeUpdate(sql);
            if(num>0){
                System.out.println("插入成功！");
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        } finally {
            JdbcUtils.release(conn,st,rs);
        }
    }
}
